﻿
set(MQTT_FOUND "NO")

if (WIN32)
    include_directories(${PROJECT_ROOT}/libs/mqtt/include)

    find_path(MQTT_INCLUDE_DIR mosquitto.h
        ${PROJECT_ROOT}/libs/mqtt/include)

    find_library(MQTT_MOSQUITTO_LIBRARY_RELEASE_DEBUG
        NAMES mosquitto
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/mqtt/lib
        )

    find_library(MQTT_MOSQUITTOPP_LIBRARY_RELEASE_DEBUG
        NAMES mosquittopp
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/mqtt/lib
        )

else(WIN32)
    find_path(MQTT_INCLUDE_DIR mosquitto.h
        /Library/Frameworks
        /usr/local
        /usr
        )

    find_library(MQTT_MOSQUITTO_LIBRARY_RELEASE_DEBUG
        NAMES libmosquitto mosquitto
        PATH_SUFFIXES lib
        HINTS $ENV{MQTT_INCLUDE_DIR}
        )

    find_library(MQTT_MOSQUITTOPP_LIBRARY_RELEASE_DEBUG
        NAMES libmosquittopp mosquittopp
        PATH_SUFFIXES lib
        HINTS $ENV{MQTT_INCLUDE_DIR}
        )

endif(WIN32)

if (MQTT_INCLUDE_DIR AND MQTT_MOSQUITTO_LIBRARY_RELEASE_DEBUG AND MQTT_MOSQUITTOPP_LIBRARY_RELEASE_DEBUG)
    set(MQTT_FOUND "YES")
endif ()

message(${MQTT_FOUND})
